package com.etc.service;

import com.etc.dao.IBusinessDao;
import com.etc.dao.IGoodsDao;
import com.etc.entity.Business;
import com.etc.entity.Goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BusinessService {

   @Autowired
   IBusinessDao businessDao;

   @Autowired
   IGoodsDao goodsDao;


   // 查询所有的管理类
   public List<Business> queryAllBusiness() {
       return businessDao.queryAllBusiness();
   }
   // 获取指定页码的管理类
   public List<Business> queryBusiness(int page) {
       return businessDao.queryBusiness(page * 5);
   }
   // 根据页码和名字获取管理类
   public List<Business> queryBusinessFilter(int page, String name) {
       return businessDao.queryBusinessFilter(page *5, name);
   }
   //根据名字获取管理类总数
   public int queryAllBusinessFilter(String name) {
       return businessDao.getAllFilter(name);
   }
   //根据id获取管理类
   public Business queryBusiness3(int id) {
       return businessDao.queryBusiness3(id);
   }
   // 获取总数量
   public int getAll() {
	   
       return businessDao.getAll();
   }
   
   // 更新
   public int updateBusiness(Business u) {
	   return businessDao.updateBusiness(u);
   }
   
  
  // 删除 
   public int deleteBusiness(int id) {
	  return businessDao.deleteBusiness(id);
   }

    public List<Goods> selectGoods(int id){
        return goodsDao.selectGoods(id);
    }



    public int updateStatus(int id, int groundingId) {
       return goodsDao.updateStatus(id,groundingId);
    }
}
